<!--
#    Copyright 2008, 2009 Tri-County Electric Cooperative, St. Matthews, South Carolina
#    This file is part of COOPGIS.
#    COOPGIS is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    COOPGIS is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#    You should have received a copy of the GNU General Public License
#    along with COOPGIS.  If not, see <http://www.gnu.org/licenses/>.
-->

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style type="text/css">
        #map {
            width: 1200px;
            height: 600px;
            border: 1px solid black;
        }
    </style>
    <script src="/openlayers/lib/OpenLayers.js"></script>
    <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>


    
    <title>COOPGIS Map Setup</title>
  </head>
  <body>
<b>{{LoginStatus}}</b>   &nbsp&nbsp&nbsp&nbsp <small><a href="/coopgis/">Main Menu</a></small>
        &nbsp&nbsp&nbsp&nbsp <small><a href="/coopgis/mapsetup/template/">Map TemplateSetup</a></small>
<br>
Special Instructions:  <b>{{Instructions}}</b>
<br>
<table>
<form method="post" action="">
<tr><td><input type="submit"/></td></tr>
<tr><td valign="top">
<table><tr><td><b>Update File</b></td><td> {{form.UpdateIndicator}} Delete {{form.DeleteIndicator}}</td></tr>
<tr><td>Existing File</td><td>{{form.NameExistingList}}</td></tr>
<tr><td>Name</td><td> {{form.Name}}</td>
<tr><td>Content</td><td>{{form.Content}}</tr>
</table>


<br>
View of Last Submitted Map  <br>
<div id="map">
  <script defer="defer" type="text/javascript">
	  var options = {
        projection: new OpenLayers.Projection("EPSG:3857"),
        displayProjection: new OpenLayers.Projection("EPSG:4326"),
        units: "m",
        numZoomLevels: 21, 
        maxResolution: 'auto', 
        maxExtent: new OpenLayers.Bounds(-9107000, 3922000, -8865000, 4126000),
        'tileSize': new OpenLayers.Size(1024,768)
        };
    var bnd = new OpenLayers.Bounds(-9107000, 3922000, -8865000, 4126000);
    var map = new OpenLayers.Map('map', options);
    var emap = new OpenLayers.Layer.MapServer("ElectricNetwork", 
                  "/cgi-bin/mapserv?MAP={{MapFileName}}",
                  {Layers:"Station Zooomed In",
		   'buffer':0, 
                   'sphericalMercator': 'true',
                  'projection': new OpenLayers.Projection("EPSG:3857")},
                  {visibility: true,
                   isBaseLayer: false});
		var gsat = new OpenLayers.Layer.Google(
		    "Google Satellite",
  		  {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
    		// used to be {type: G_SATELLITE_MAP, numZoomLevels: 22}
    );
	  var gmap = new OpenLayers.Layer.Google(
      	"Google Streets", // the default
   	   {numZoomLevels: 20}
  	    // default type, no change needed here
	  );
    var gphy = new OpenLayers.Layer.Google(
        "Google Physical",
        {type: google.maps.MapTypeId.TERRAIN}
        // used to be {type: G_PHYSICAL_MAP}
    );
    var ghyb = new OpenLayers.Layer.Google(
        "Google Hybrid",
        {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
        // used to be {type: G_HYBRID_MAP, numZoomLevels: 20}
    );
    


    var options = {numZoomLevels: 22};

            var graphic = new OpenLayers.Layer.Image(
                'Background',
                '/music/mapbackground.png',
                bnd,
                new OpenLayers.Size(1024, 768),
                options
            );
            
            graphic.events.on({
                loadstart: function() {
                    OpenLayers.Console.log("loadstart");
                },
                loadend: function() {
                    OpenLayers.Console.log("loadend");
                }
            });



    blank = new OpenLayers.Layer("Blank",{isBaseLayer: true});
    map.addLayers([graphic, gsat, gmap, gphy, ghyb, emap]);
    map.addControl(new OpenLayers.Control.LayerSwitcher());
    map.addControl(new OpenLayers.Control.Permalink());
    map.addControl(new OpenLayers.Control.MousePosition());
    if (!map.getCenter()) {map.zoomToExtent(bnd)}
	    {{ OpenLayersZoom }}

  </script></div>



</ul>
  </body>
</html>
